package com.m3958.firstgwt.server.dao;


import java.util.Date;

import com.m3958.firstgwt.server.model.VoteTpl;



public class VoteTplChangeStrategy extends BaseModelChangeStrategy implements ModelChangeStrategy<VoteTpl> {
	
	@Override
	public boolean extraPersistTask(VoteTpl model) {
		model.setUpdatedAt(new Date());
		if(!getSu().isSuperman()){
			if("system".equals(model.getFlag())){
				model.setFlag("private");
			}
		}
		return true;
	}

	@Override
	public boolean extraUpdateTask(VoteTpl model,VoteTpl newModel){
		newModel.setUpdatedAt(new Date());
		if(!getSu().isSuperman()){
			if("system".equals(model.getFlag())){
				model.setFlag("private");
			}
		}
		return true;
	}
	
	@Override
	public boolean extraRemoveTask(VoteTpl model) {
		return true;
	}
	

	@Override
	public boolean afterPersist(VoteTpl model) {
		return false;
	}
}

	
